package com.cweb.admin.model.bbs.bbs_article_info.controller;


import com.cweb.admin.configuration.annotation.NoLoginCheck;
import com.cweb.admin.model.bbs.bbs_article_info.entity.BbsArticleInfo;
import com.cweb.admin.model.bbs.bbs_article_info.service.BbsArticleInfoService;
import com.cweb.framework.annotation.Remark;
import com.cweb.framework.pojo.BaseResponse;
import com.cweb.framework.pojo.CustomException;
import com.cweb.framework.pojo.PageParam;
import com.cweb.framework.util.MybatisUtil;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import com.cweb.framework.base.controller.BaseController;

/**
 * 论坛-文章信息 前端控制器
 * @author changfan
 */
@RestController
@RequestMapping("bbs/article")
public class BbsArticleInfoController extends BaseController {
    @Autowired
    private BbsArticleInfoService bbsArticleInfoService;

    /**
     * 新增文章
     */
    @RequestMapping("make")
    @Remark(name = "用户新建文章", describe = "")
    public BaseResponse make(BbsArticleInfo param) throws CustomException {
        return new BaseResponse(bbsArticleInfoService.make(param));
    }
    /**
     * 取得文章列表
     */
    @RequestMapping("list")
    @Remark(name = "查询文章列表", describe = "")
    @NoLoginCheck
    public BaseResponse list(BbsArticleInfo param, PageParam pageParam) throws CustomException {
        return new BaseResponse(bbsArticleInfoService.getList(param, pageParam));
    }

    /**
     * 取得文章内容
     */
    @RequestMapping("get")
    @Remark(name = "查询文章内容", describe = "")
    @NoLoginCheck
    public BaseResponse get(@Param(value = "id") Long id) throws CustomException {
        return new BaseResponse(bbsArticleInfoService.detail(id));
    }
}

